<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title>教室管理</title>
	<link rel="stylesheet" href="../css/common2.css">
	<link rel="stylesheet" href="../css/urlty.css">
	<style>
		.state {
			color: white;
			border-radius: 3px;
			font-size: 14px;
			font-weight: bold;
			padding: 4px;
			background-color: #4BAF4F;
		}

		.conduct {
			background-color: #F8B551;
		}

		.end {
			background-color: #E64919;
		}

		.class-end {
			background-color: #9F9F9F;
		}

		#vue-root {
			padding-top: 20px;
		}
	</style>
</head>

<body>
	<div id="vue-root">
		<a href="eliminate_classroom_item.html" v-if="able.add" style="color: white">
			<div class="add">添加教室</div>
		</a>
		<div class="table">
			<table class="table_top">
				<thead>
					<tr>
						<th>
							<input type="checkbox" class="check-box" v-model="all">序号
						</th>
						<th>教室名称</th>
						<th>课程地址</th>
						<th>教室状态</th>
						<th>编辑/删除</th>
					</tr>
				</thead>
				<tbody id="list">
					<tr v-for="(room,index) in list" :key="room.id">
						<td>
							<input type="checkbox" class="check-box" v-model="room.checked">
							<span v-text="index+1"></span>
						</td>
						<td v-text="room.name"></td>
						<td v-text="room.address"></td>
						<td v-text="room.disabled?'不可用':'正常'"></td>
						<td>
							<div class="option">
								<div class="edit-icon option-icon" v-if="able.edit" style="position: absolute; left: 20%; top: 30%;">
									<a :href="'eliminate_classroom_item.html?id='+room.id">
										<img class="img" src="../image/edit.png" height="20" width="20"
											onmouseover="this.src='../image/edit_light.png'"
											onmouseout="this.src='../image/edit.png'">
									</a>
								</div>
								<div class="delete-icon option-icon" v-if="able.del" style="right: 20%; top:30%;position: absolute;"
									@click="del([room.id])">
									<img class="img" src="../image/delete.png" height="20" width="20"
										onmouseover="this.src='../image/delete_light.png'"
										onmouseout="this.src='../image/delete.png'">
								</div>
							</div>
						</td>
					</tr>

				</tbody>
			</table>
		</div>
		<div class="delete" @click="batchDelete" v-if="able.del&&total>1">批量删除</div>
		<ul class="pagination" v-if="pages>1">
			<li>
				<a v-if="pageNum!=1" @click="pageNum=1">«</a>
				<a class="pages-jump" v-if="pageNum!=1" @click="pageNum--">‹</a>
				<a v-text="pageNum"></a>
				<a class="pages-jump" v-if="pageNum!=pages" @click="pageNum++">›</a>
				<a v-if="pageNum!=pages" @click="pageNum=pages">»</a>
			</li>
		</ul>
		<div style="float: right;">
			总共{{total}}条记录
			<select class="ui-select init" style="height:32px" v-model="pageSize">
				<option :value="10">每页10条</option>
				<option :value="30">每页30条</option>
				<option :value="100">每页100条</option>
			</select>
		</div>
	</div>

	<script src="/scriptZIP/qs.min.js"></script>
	<script src="/scriptZIP/vue.min.js"></script>
	<script src="/scriptZIP/axios.min.js"></script>
	<script src="/js/common.js"></script>
	<script src="/js/list.js"></script>
	<script src="/js/auth_util.js"></script>

	<script>

		var app = new Vue(merge({
			data: {
				urls: {
					del: '/pc/room/del',
					list: '/pc/room/list/' + top_params().id
				}
			},
			created () {
				
				abled('classroom', this);
				this.getData();
			},
		}));
	</script>
</body>

</html>